package net.qiqbframework.event.dao.mpimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.qiqbframework.eventsourcing.dao.DomainEventProcessDao;
import net.qiqbframework.eventsourcing.dao.DomainEventRecordPo;
import net.qiqbframework.mp.BasicEntityPoDaoMpImpl;


import java.util.List;

public class DomainEventProcessDaoMpImpl extends BasicEntityPoDaoMpImpl<DomainEventProcessMapper, DomainEventRecordPo> implements DomainEventProcessDao {

    @Override
    public List<DomainEventRecordPo> listByEventIdAndListenerId(String applicationName, String eventId, String listenerId) {
        QueryWrapper<DomainEventRecordPo> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda()
                .eq(DomainEventRecordPo::getApplicationName, applicationName)
                .eq(DomainEventRecordPo::getHandlerDescription, listenerId)
                .eq(DomainEventRecordPo::getEventId, eventId);
        return super.list(queryWrapper);
    }

    @Override
    public DomainEventRecordPo getPoById(String id) {
        return super.getById(id);
    }
}
